Total Complexity | 8 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import path from 'path'; |
||
7 | export default class Test { |
||
8 | createAPI(url = 'http://mock/', opts = undefined) { |
||
9 | return new API(url, opts); |
||
10 | } |
||
11 | |||
12 | async setTmpFolder() { |
||
13 | await fse.ensureDir(tmpFolder); |
||
14 | } |
||
15 | |||
16 | async cleanTmpFolder() { |
||
17 | await fse.remove(tmpFolder); |
||
18 | } |
||
19 | |||
20 | mockAPI() { |
||
21 | mockAPI(); |
||
22 | } |
||
23 | |||
24 | unMockAPI() { |
||
25 | unMockAPI(); |
||
26 | } |
||
27 | |||
28 | async startMockApp() { |
||
29 | this._server = await startMockApp(); |
||
30 | } |
||
31 | |||
32 | get mockAppUrl() { |
||
33 | const { port } = this._server.address(); |
||
34 | |||
35 | return `http://localhost:${port}`; |
||
36 | } |
||
37 | |||
38 | async stopMockApp() { |
||
39 | await stopMockApp(this._server); |
||
40 | } |
||
41 | } |
||
42 | |||
58 |